int PIN_1A = 10;
int PIN_1B = 11;
int analogPin = 3;  // potentiometer connected to analog pin 3
int val = 0;        // variable to store the read value

const int FACE_FORWARD = 1;
const int FACE_BACK = 2;

int pwm_vals[4] = { 40, 100, 255 };
int idx = 0;

int direction = FACE_FORWARD;

void setup() {
  Serial.begin(9600); // open the serial port at 9600 bps:
  
  pinMode(PIN_1A, OUTPUT);
  pinMode(PIN_1B, OUTPUT);
}

void forwardA() {
  analogWrite(PIN_1A, 100);
  analogWrite(PIN_1B, 0);
}

void stop() {
  analogWrite(PIN_1A, 0);
  analogWrite(PIN_1B, 0);
}

void moveA(int speed, int face) {
  if (FACE_FORWARD == face) {
    analogWrite(PIN_1A, speed);
    analogWrite(PIN_1B, 0);
  } else {
    analogWrite(PIN_1A, 0);
    analogWrite(PIN_1B, speed);
  }
}



void loop() {
  for (int i = 0; i < 255; ) {
    Serial.println(i);
    moveA(i, FACE_FORWARD);
    delay(1000);
    stop();
    delay(1000);

    i += 10;
  }
}